package com.im.event;

import android.text.TextUtils;

import com.core.sdk.core.BaseEvent;
import com.core.sdk.core.Location;
import com.im.model.XmppMessage;

public class FileResultReivedEvent extends BaseEvent{

	private static final long serialVersionUID = 1L;
	public enum ReceivedStatus{
		receiving,finished,failed
	}
	
	private FileType fileType;
	private String filePath;
	String fromUser;
	ReceivedStatus receivedStatus;
	String desc = null;
	final XmppMessage xmppMessage;
	
	/**
	 * 接收
	 */
	public FileResultReivedEvent(Location to,FileType fType,String filePath,String fromUser,ReceivedStatus receivedStatus,String desc,String toUser) {
		super(to);
		this.fileType = fType;
		this.filePath = filePath;
		this.fromUser = fromUser;
		this.receivedStatus = receivedStatus;
		this.desc = desc;
		
		int msgType =XmppMessage.MSG_TYPE_OTHER ;
		if(fType == FileType.img){
			msgType = XmppMessage.MSG_TYPE_IMG;
		}else if(fType == FileType.audio){
			msgType = XmppMessage.MSG_TYPE_AUDIO;
		}
		xmppMessage = new XmppMessage(filePath, fromUser, toUser, false, msgType);
		if(!TextUtils.isEmpty(desc.trim())){
			xmppMessage.setDesc(desc.trim());	
		}
	}

	public FileType getFileType() {
		return fileType;
	}

	public void setFileType(FileType fileType) {
		this.fileType = fileType;
	}

	public String getFilePath() {
		return filePath;
	}

	public void setFilePath(String filePath) {
		this.filePath = filePath;
	}

	public String getFromUser() {
		return fromUser;
	}

	public void setFromUser(String fromUser) {
		this.fromUser = fromUser;
	}

	public ReceivedStatus getReceivedStatus() {
		return receivedStatus;
	}

	public void setReceivedStatus(ReceivedStatus receivedStatus) {
		this.receivedStatus = receivedStatus;
	}

	public String getDesc() {
		return desc;
	}

	public XmppMessage getXmppMessage() {
		return xmppMessage;
	}
	
	
}
